 {
        
        var o = require("../../UIManager/UISoundManager.js");
        cc.Class({
            extends: cc.Component,
            properties: {
                labWinScore: {
                    default: null,
                    type: cc.Label
                },
                labWinName: {
                    default: null,
                    type: cc.Label
                },
                content: {
                    default: null,
                    type: cc.Node
                },
                listItem: {
                    default: null,
                    type: cc.Prefab
                },
                nodeTileContent: {
                    default: null,
                    type: cc.Node
                },
                nodeBtn: {
                    default: null,
                    type: cc.Node
                },
                nodeStandTile: {
                    default: null,
                    type: cc.Prefab
                },
                nodePengTile: {
                    default: null,
                    type: cc.Prefab
                },
                nodeGangTile: {
                    default: null,
                    type: cc.Prefab
                },
                btnWinMask: {
                    default: null,
                    type: cc.Button
                },
                bg: {
                    default: null,
                    type: cc.Node
                },
                nodeSharePre: {
                    default: null,
                    type: cc.Prefab
                },
                lblDoublePayLeftNum: {
                    default: null,
                    type: cc.Label
                },
                nodeProgressTip: {
                    default: null,
                    type: cc.Node
                },
                _gameEndInfo: null,
                _gameEndInfoEx: null,
                _isShowDetail: !1,
                _isError: !1
            },
            onLoad: function () {
                try {
                    Global.notificationCenter.on(Global.eventName.MSG_HAPPYBAG5, this.showProgressTip.bind(this), this),
                        Global.notificationCenter.on(Global.eventName.MSG_PAY_SHARE_RESULT, this.payResultHandler.bind(this), this),
                        this.btnWinMask.getComponent(cc.Widget).target = SceneHelper.getCurScene(), this.bg.getComponent(cc.Widget).target = SceneHelper.getCurScene(),
                        this.btnWinMask.getComponent(cc.Widget).updateAlignment(), this.bg.getComponent(cc.Widget).updateAlignment(),
                        this.chuxianAnim = this.node.getComponent(cc.Animation);
                    var e = this.btnWinMask.node;
                    e.on(cc.Node.EventType.TOUCH_START, this.onTouchStart.bind(this), this), e.on(cc.Node.EventType.TOUCH_END, this.onTouchEnd.bind(this), this),
                        e.on(cc.Node.EventType.TOUCH_CANCEL, this.onTouchCancel.bind(this), this), this._btnChange = Global.utils.searchNode(this.nodeBtn, "btnChange"),
                        this._btnContinue = Global.utils.searchNode(this.nodeBtn, "btnContinue"), this._btnNewPanel = Global.utils.searchNode(this.nodeBtn, "btnNewPanel"),
                        console.log("lbl ==== lbl", this._btnNewPanel, this.lblDoublePayLeftNum, this.nodeBtn, this._btnChange);
                    var t = Global.tableModel.getPlayerModel(Global.config.SEAT_DOWN);
                    this._doubleLeftNum = t.getDoubleWinCount(), this.lblDoublePayLeftNum.string = "今日剩余" + this._doubleLeftNum + "次",
                        this._showConfigUI = Global.configCdn.getUISwitch(), this.hasDouble = !1, this._showConfigUI && this._doubleLeftNum > 0 && Global.roomInfoModel.getNotZiZunOrFuHao() ? (this._btnNewPanel.active = !0,
                        this._btnChange.active = !1, this._btnContinue.active = !1, this.hasDouble = !0,
                        this.btnDahuDoublepay = Global.utils.searchNode(this._btnNewPanel, "btnDahuDoublePay"),
                        t.getDoubleWinByAD() ? Global.utils.searchNode(this.btnDahuDoublepay, "New Sprite").getComponent(cc.Sprite).spriteFrame = Global.spriteAtlas.getSpriteFrame("AD_kanshipinshuangbei") : Global.utils.searchNode(this.btnDahuDoublepay, "New Sprite").getComponent(cc.Sprite).spriteFrame = Global.spriteAtlas.getSpriteFrame("TY_shuangbei")) : (this._btnNewPanel.active = !1,
                        this._btnChange.active = !0, this._btnContinue.active = !0);
                } catch (e) {
                    console.error("NodeGameResultMajorController error:", e), this._isError = !0;
                    var n = new Date(),
                        o = "NodeGameResultMajorController userId:" + tywx.UserInfo.userId + "time:" + n.toDateString() + " " + n.toTimeString() + ";" + e.message;
                    tywx.BiLog.uploadLogTimely(o), this.onClickContinue();
                }
            },
            start: function () {
                this.chuxianAnim && (this.chuxianAnim.on("finished", function () {
                    this.chuxianAnim.play("dahuxunhuan");
                }.bind(this), this), this.chuxianAnim.play()), Global.msgHandler.requestTaskData();
            },
            onShowResult: function (e) {
                this.node.setScale(e), 0 == e ? Global.utils.showBanner(!1) : 1 == e && Global.utils.showBanner(!0, null, 0, 0);
            },
            onTouchStart: function (e) {
                this.onShowResult(0), e.stopPropagation();
            },
            onTouchEnd: function (e) {
                this.onShowResult(1), e.stopPropagation();
            },
            onTouchCancel: function (e) {
                this.onShowResult(1), e.stopPropagation();
            },
            showProgressTip: function (e) {
                console.log("showProgressTip result= ", e);
                var t = 1;
                Global.roomInfoModel.getPlayModel() == Global.config.playModel.ERREN && (t = 4);
                var n = Global.ActivityTaskModel.getActivitiesConfArrByIndex(t);
                if (console.log("showProgressTip configArr= ", n), e && n && n.length > 0 && "list" == e.action) {
                    for (var o = !1, i = null, a = null, r = 0; r < n.length; r++) {
                        a = n[r];
                        for (var s = 0; s < e.tasks.length; s++) {
                            var l = e.tasks[s];
                            if (l && a.kindId == l[1] && 0 == l[3]) {
                                o = !0, i = l;
                                break;
                            }
                        }
                        if (o) break;
                    }
                    if (o && null != i) {
                        this.nodeProgressTip.active = !0;
                        var c = Global.utils.searchComp(this.nodeProgressTip, "tip", cc.Label),
                            d = a.progressMax - i[2];
                        c.string = "再玩" + d + "局可领取" + a.reward + "金币！";
                    } else this.nodeProgressTip.active = !1;
                    this.onRefreshCompleteRedPacket(e);
                } else this.nodeProgressTip.active = !1;
            },
            onRefreshCompleteRedPacket: function (e) {
                var t = Global.configCdn.getUISwitchConf(), n = !1;
                if (t && t.isRookieManRedPacketTask && (n = t.isRookieManRedPacketTask || !1), 0 != n) {
                    var o = (Global.configCdn.getActivityAndTaskConf() || Global.configCdn.getDefaultConfig("activityAndTask")).redPacketkinds,
                        i = 0;
                    if (o) for (var a = 0; a < o.length; a++) for (var r = o[a], s = 0; s < e.tasks.length; s++) {
                        var l = e.tasks[s];
                        r.kindId == l[1] && 0 == a && ((i = r.progressMax - l[2]) > 0 ? Global.utils.showNodeCommon("再玩" + i + "局即可领取现金红包", 3) : 1 == l[3] && Global.boolTipsRedPacket && (Global.utils.showNodeCommon("恭喜您已获得0.3元微信红包，请到大厅查看！", 3),
                            Global.boolTipsRedPacket = !1));
                    }
                } else cc.log("新手屏蔽+++config.isRookieManRedPacketTask");
            },
            bindData: function (e) {
                if (this._isError) console.error("NodeGameResultMajorController bindData error"); else {
                    this._gameEndInfo = e;
                    var t = Global.tableModel.getPlayerModel(Global.config.SEAT_DOWN);
                    t && (this._gameEndInfoEx = t.getDetailInfo()), this.refresh();
                }
            },
            refresh: function () {
                for (var e = 0; e < this._gameEndInfo.infos.length; ++e) {
                    var t = this._gameEndInfo.infos[e];
                    if (Global.tableModel.toLocalSeatIndex(t.seatId) == Global.config.SEAT_DOWN) {
                        this.refreshSelf(t), this.refreshTiles(t), t.daHuFan || 0;
                        break;
                    }
                }
                if (this._gameEndInfoEx) {
                    var n = null, o = null, i = this._gameEndInfoEx.length > 1;
                    for (e = 0; e < this._gameEndInfoEx.length; ++e) n = cc.instantiate(this.listItem),
                    this.content && this.content.addChild(n), (o = n.getComponent("NodeGameResultMajorListItemController")) && o.bindData(this._gameEndInfoEx[e], i);
                }
            },
            showFriendRoomBtn: function () {
                Global.tableModel.getTableType() == Global.config.tableType.CREATE && (this._btnNewPanel.active = !1,
                    this._btnContinue.active = !0, this._btnChange.active = !0);
            },
            refreshSelf: function (e) {
                var t = "";
                e.totalScore >= 0 && (t = "+");
                var n = "";
                e.patternInfo && e.patternInfo.length > 0 && (n = e.patternInfo[0]), this.labWinScore.string = t + e.totalScore,
                    this.labWinName.string = n + " " + e.totalFan + Global.utils.getUnit(), this.showFriendRoomBtn();
            },
            refreshTiles: function (e) {
                var t = e.tilesInfo.peng.length + e.tilesInfo.gang.length,
                    n = 78 * e.tilesInfo.tiles.length + 48 + 144 * e.tilesInfo.peng.length + 144 * e.tilesInfo.gang.length + 20 * (t - 1);
                console.log("totalLentotalLentotalLentotalLentotalLen:", n), this.nodeTileContent.scale = 800 / n;
                for (var o = n / 2 * -1, i = 0; i < e.tilesInfo.tiles.length; i++) {
                    var a = e.tilesInfo.tiles[i];
                    (l = (s = cc.instantiate(this.nodeStandTile)).getComponent("standTileDownController")) && l.updateTile(a, -1, !0),
                    this.nodeTileContent && this.nodeTileContent.addChild(s);
                    var r = cc.p(o, 0);
                    s.setPosition(r), o = s.width + o;
                }
                o += 48;
                for (i = 0; i < e.tilesInfo.peng.length; i++) {
                    a = e.tilesInfo.peng[i];
                    (l = (s = cc.instantiate(this.nodePengTile)).getComponent("PengPatternController")) && l.bindData(a),
                    this.nodeTileContent && this.nodeTileContent.addChild(s);
                    r = cc.p(o, 0);
                    s.setPosition(r), o = s.width + o + 20;
                }
                for (i = 0; i < e.tilesInfo.gang.length; i++) {
                    var s, l;
                    a = e.tilesInfo.gang[i];
                    (l = (s = cc.instantiate(this.nodeGangTile)).getComponent("PengPatternController")) && l.bindData(a),
                    this.nodeTileContent && this.nodeTileContent.addChild(s);
                    r = cc.p(o, 0);
                    s.setPosition(r), o = s.width + o + 20;
                }
            },
            onClickDetail: function () {
            },
            onClickShare: function () {
                o.playEffect("select");
                var e = function (e) {
                    console.log("分享成功"), Global.utils.showBanner(!0), n && (n.destroy(), n = null);
                }, t = function (e) {
                    console.log("分享失败"), Global.utils.showBanner(!0), n && (n.destroy(), n = null);
                }, n = cc.instantiate(this.nodeSharePre), i = cc.instantiate(this.nodeTileContent);
                i.scale = .35, i.setPosition(190.5, -248.9);
                for (var a = 0; a < i.childrenCount; a++) {
                    var r = i.children[a].getComponent("standTileDownController");
                    r && r.setInScreenShoot();
                }
                n && (n.addChild(i, n.childrenCount), SceneHelper.getCurScene().addChild(n, 102)),
                    n.getChildByName("labWinName").getComponent(cc.Label).string = this.labWinName.string;
                var s = {
                    width: n.width,
                    height: n.height
                };
                Global.utils.showBanner(!1), this.scheduleOnce(function () {
                    var n = {
                        share_type: Global.config.sharePointId.bigHuInvite
                    };
                    tywx.PropagateInterface.getWeightShareConfigInfoByTypeWithShare(n, null, e, t, s);
                }, 0);
            },
            onClickChange: function () {
                o.playEffect("select"), Global.utils.showWaitting();
                Global.roomInfoModel.getPlayModel();
                var e = Global.roomInfoModel.getRoomId(), t = Global.tableModel.getTableId(),
                    n = Global.tableModel.getSeatId();
                Global.msgHandler.requestTableLeave(e, t, n), this.quickStart();
            },
            onClickContinue: function () {
                o.playEffect("select"), Global.utils.showWaitting();
                if (Global.tableModel.getTableType() == Global.config.tableType.CREATE) if (Global.tableModel.getIsShowTotalResult()) {
                    var e = Global.tableModel.getTotalResult();
                    this.onShowTotalResult(e), this.node.active = !1;
                } else {
                    SceneHelper.loadScene("waittingScene", function () {
                        Global.utils.hideWaitting(), Global.msgHandler.requestNextRound(Global.tableModel.getRoomId(), Global.tableModel.getTableId(), Global.tableModel.getSeatId());
                    });
                } else this.quickStart();
            },
            onClickDoublePay: function () {
                if (o.playEffect("select"), this.hasDouble && !(this._doubleLeftNum <= 0)) {
                    var e = this, t = function (t) {
                        var n = !1;
                        t && (n = Global.utils_Share.checkOpenGId(t)), console.log("onClickDoublePay", t, n),
                            n ? Global.utils.showNodeCommon("换个群试试，不要频繁打扰同一个群哦！", 3) : e.scheduleOnce(function () {
                                cc.warn("onClickDoublePay after");
                                Global.msgHandler.requestResultPay(1);
                            }, .2);
                    };
                    Global.tableModel.getPlayerModel(Global.config.SEAT_DOWN).getDoubleWinByAD() ? Global.utils.showViewAd(Global.config.adUnitId, t, function () {
                        Global.utils.showNodeCommon("您在播放中途退出，无法领取游戏奖励", 3);
                    }) : Global.utils_Share.shareToGroup(Global.config.sharePointId.bigHuInvite, t);
                }
            },
            payResultHandler: function (e) {
                var t = e.deltaChip;
                this._btnNewPanel && this._btnNewPanel.active && (o.playReward(), this._doubleLeftNum -= 1,
                    this._doubleLeftNum = this._doubleLeftNum < 0 ? 0 : this._doubleLeftNum, this.lblDoublePayLeftNum.string = "今日剩余" + this._doubleLeftNum + "次",
                    this.btnDahuDoublepay = Global.utils.searchNode(this._btnNewPanel, "btnDahuDoublePay"),
                    this.btnDahuDoublepay.color = new cc.Color(165, 165, 165), Global.utils.searchNode(this.btnDahuDoublepay, "New Sprite").getComponent(cc.Sprite).node.color = new cc.Color(165, 165, 165),
                    this.hasDouble = !1, Global.utils.showNodeCommon("系统额外奖励了" + t + "金币\n今日还可双倍" + this._doubleLeftNum + "次", 3));
            },
            onClickBack: function () {
                o.playEffect("select"), SceneHelper.loadScene("selectScene");
                var e = Global.tableModel.getRoomId(), t = Global.tableModel.getTableId(),
                    n = Global.tableModel.getSeatId();
                if (0 != e && 0 != t) return cc.error("WaittingController onClickBack", "roomId = " + e + " tableId = " + t + " seatId = " + n),
                    void Global.msgHandler.requestTableLeave(e, t, n);
            },
            quickStart: function () {
                Global.tableModel.setAllowPopupRotateLuckInGameEnd(!0);
                var e = {
                    playMode: Global.roomInfoModel.getPlayModel() || Global.config.playModel.XUELIU,
                    gameId: Global.config.GAMEID || Global.config.GAMEID_NORMAL,
                    roomId: Global.roomInfoModel.getRoomId(),
                    type: "NodeGameResultMajorController quickStart"
                };
                Global.notificationCenter.emit(Global.eventName.MSG_DO_QUICK_START, e);
            },
            onShowTotalResult: function (e) {
                cc.loader.loadRes("prefabs/nodeGameTotalResult", cc.Prefab, function (t, n) {
                    var i = cc.instantiate(n);
                    console.log("预制节点===", i);
                    var a = Global.utils.searchNode(SceneHelper.getCurScene(), "Node_result");
                    if (a && i) {
                        a.addChild(i, 10), i.setPosition(cc.p(0, 50));
                        var r = i.getComponent("GameTotalResultController");
                        console.log("controller ==", r), r.bindData(e), o.playGameEnd();
                    }
                });
            },
            onDestroy: function () {
                Global.tableModel.setAllowPopupRotateLuckInGameEnd(!1), Global.notificationCenter.offAll(this);
            }
        })
    }